package adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;
import zhang.automobileservice.R;


/**
 * Created by Administrator on 2016/7/21.
 */
public class PopCarPriceAdapter extends BaseAdapter{

    final String tag = "PopAdapter";
    private List<String> strList;
    private LayoutInflater inflater;
    private Context context;
    private int mposition;

    public PopCarPriceAdapter(Context context,List<String> strList, int position) {
        this.strList = strList;
        inflater = LayoutInflater.from(context);
        this.mposition = position;
        this.context = context;
    }

    @Override
    public int getCount() {
        return strList.size();
    }

    @Override
    public Object getItem(int position) {
        return strList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = inflater.inflate(R.layout.pop_car_item,null);
        TextView content = (TextView) convertView.findViewById(R.id.bt_content);
        if(mposition==position){
            content.setBackground(context.getDrawable(R.drawable.loginedittext_background));
            content.setTextColor(context.getResources().getColor(R.color.textcolor));
        }
        content.setText(strList.get(position));
        return convertView;
    }

}


